<template>
  <div>
    <h3>主页面</h3>
    <p>{{ $store.state.user.username }}</p>
  </div>
</template>

<script>
export default {
    data(){
        return{

        }
    },
    mounted(){
        let user_json=localStorage.getItem('user')
        if(user_json){
            let user_obj=JSON.parse(user_json)
            this.$store.commit('setUser',user_obj)
        }
    },

}
</script>

<style>

</style>